home *** CD-ROM | disk | FTP | other *** search
- 10 rem (c) 1988 uptime magazine
- 20 rem (c) 1988 softdisk publishing
- 30 :
- 40 rem author: noel nyman
- 50 :
- 60 rem ****************************
- 70 rem initialize variables
- 80 rem ****************************
- 90 :
- 100 case=peek(53272) and 14: rem '4' if upper/graphics, '6' if lower/upper
- 110 if case=4 then print chr$(14): rem shift to lower/upper
- 120 r=0: rem flag for relative file reading
- 130 s=0: rem flag for sequential file reading
- 140 p=0: rem flag for program files
- 150 dim x, x$: rem global counter and misc input
- 160 dim f$: rem file name
- 170 dim er, er$: rem used for disk error messages
- 180 dim a$, b$, ad: rem used by 'prg' option
- 190 :
- 200 rem ****************************
- 210 rem main program
- 220 rem ****************************
- 230 :
- 240 print "[147]" tab(13) " [198][201][204][197] [210][197][193][196][197][210] "
- 250 print " written for [211]oftdisk [208]ublishing
- 260 [153] [163]13) "by (NULL)oel (NULL)yman
- 270 :
- 280 rem --- get file name in fl$, make sure it's legal size
- 290 rem -------------------------------------------------------
- 300 :
- 310 print "[197]nter a file name to read, or '*'
- 320 [153] [163]10) "to quit: ";
- 330 [159]1,0: [132]1,f$: [160]1: [153]
- 340 [139] [200](f$,1)[178]"*" [167] [153] "load": [137]980: [143] end program
- 350 [139] [195](f$)[179]17 [137]510: [143] length of file name okay
- 360 :
- 370 [143] --- file name too long, prompt and get a new one
- 380 [143] -------------------------------------------------------
- 390 :
- 400 [153] "(NULL)he file name cannot be longer than
- 410 print " sixteen characters.
- 420 [153] "---(NULL)ress any key to continue---
- 430 get x$: if x$="" goto430
- 440 goto240
- 450 :
- 460 rem --- prompt for file type
- 470 rem --- if key is s, u, r, or p
- 480 rem --- x=1, 2, 3, or 4
- 490 rem --- for any other key, x=0
- 500 :
- 510 print "[208]ress [211]/[213]/[210]/[208] for [211][197][209], [213][211][210], [210][197][204], or [208][210][199]"
- 520 get x$: if x$="" goto520
- 530 x=-(x$="s")-(x$="[211]")-2*(x$="u")-2*(x$="[213]")
- 540 x=x-3*(x$="r")-3*(x$="[210]")-4*(x$="p")-4*(x$="[208]")
- 550 :
- 560 on x gosub1170,1250,1380,1560
- 570 if x=0 goto520: rem key was not s, u, r, or p
- 580 :
- 590 rem --- print prompt for description screens
- 600 rem -------------------------------------------
- 610 :
- 620 if s or p goto690: rem no description screen for seq or prg files
- 630 print "---[208]ress any key to continue---
- 640 [161] x$: [139] x$[178]"" [137]640
- 650 :
- 660 [143] --- open files, check for errors
- 670 [143] -----------------------------------
- 680 :
- 690 [159] 15,8,15: [143] open error channel
- 700 [141]2010: [143] check for error
- 710 [159] 2,8,2,f$: [143] open file for reading
- 720 [141]2010: [143] check for error
- 730 :
- 740 [143] --- if prg, skip to address routine
- 750 [143] ---------------------------------------
- 760 :
- 770 [139] p [167] [141]1700: [137]980: [143] show program address and ending screen
- 780 :
- 790 [143] --- read file
- 800 [143] ----------------------------
- 810 [139] [168] p [167] [153] "load(NULL)ress (NULL)left$right$asc(NULL) or (NULL)left$right$asc(NULL)/(NULL)(NULL)len(NULL) to pause---
- 820 for x=0 to 1
- 830 : get#2,x$
- 840 : if x$="" then x$=chr$(0)
- 850 : if x$=chr$(13) goto880: rem 'return' is only control code allowed
- 860 : if x$<" " or x$>"[218]" then x$=".": rem throw away control/graphics
- 870 : if x$>"_" and x$<"[193]" then x$=".": rem throw away control/graphics
- 880 : print x$;
- 890 : wait 653,1,255: rem stop only if shift is down
- 900 : x=st: rem if not end-of-file, st=0
- 910 next
- 920 if r then gosub1940: rem reading rel file
- 930 if r goto820: rem more records to read
- 940 :
- 950 rem --- end program, or re-start if f8 pressed
- 960 rem ----------------------------------------------
- 970 :
- 980 s=0: r=0: p=0: rem reset flags to 'false'
- 990 close2: close15: rem close open disk files
- 1000 print: print "[208]ress [198]8[146] to restart the program---
- 1010 [153] " (NULL)ress any other key to end
- 1020 get x$: if x$="" goto1020
- 1030 if x$="[140]" goto240: rem f8 pressed, goto to start
- 1040 if case=4 then print chr$(142): rem restore upper/graphics
- 1050 print "[147]";: rem clear screen
- 1060 end
- 1070 :
- 1080 rem ****************************
- 1090 rem subroutines
- 1100 rem ****************************
- 1110 :
- 1120 :
- 1130 rem ----------------------------
- 1140 rem --- read sequential file
- 1150 rem ----------------------------
- 1160 :
- 1170 s=-1: rem set sequential flag 'true'
- 1180 f$="0:"+f$+",s,r": rem file name set for sequential read
- 1190 return
- 1200 :
- 1210 rem ----------------------------
- 1220 rem --- read user file
- 1230 rem ----------------------------
- 1240 :
- 1250 print "[147][213][211][210], or 'user' files, are sometimes used";
- 1260 print "to hold text characters. [212]hey may also
- 1270 [153] "be used to hold binary information.
- 1280 print "[212]his program 'filters out' binary data,
- 1290 [153] "so you may see only dots when you read
- 1300 print "a [213][211][210] file.
- 1310 :
- 1320 f$[178]"0:"[170]f$[170]",u,r": [143] file name set for user read
- 1330 [142]
- 1340 :
- 1350 [143] ----------------------------
- 1360 [143] --- read relative file
- 1370 [143] ----------------------------
- 1380 [153] "load(NULL)val(NULL), or 'relative' files are special
- 1390 print "[195]ommodore data files. [212]hey contain
- 1400 [153] "'records' of data. valach record is a
- 1410 print "fixed length.": print "[217]ou can read records individually if
- 1420 [153] "you know the record number, and can
- 1430 print "give the necessary commands to the disk
- 1440 [153] "drive.": [153]"(NULL)his program does not use the record
- 1450 print "number to read the [210][197][204] file. [201]nstead,
- 1460 [153] "the data is displayed in sequence, just
- 1470 print "like a [211][197][209] file.
- 1480 :
- 1490 r[178][171]1: [143] set relative flag 'true'
- 1500 f$[178]"0:"[170]f$[170]",r,r": [143] file name set for relative read
- 1510 [142]
- 1520 :
- 1530 [143] ----------------------------
- 1540 [143] --- read program file address
- 1550 [143] ----------------------------
- 1560 [153]"load(NULL)(NULL)chr$ or 'programs' usually contain
- 1570 print "characters which are not text. [201]f they
- 1580 [153] "are printed to the screen, they can
- 1590 print "cause color changes, graphics, and
- 1600 [153] "general havoc.": [153] "ascor that reason, this program only looks";
- 1610 [153] "at the first two characters of '(NULL)(NULL)chr$'
- 1620 print "files. [212]hese tell the computer the
- 1630 [153] "starting or 'source' address of the
- 1640 print "program.
- 1650 :
- 1660 p[178][171]1: [143] set program flag 'true'
- 1670 f$[178]"0:"[170]f$[170]",p,r": [143] file name set for program
- 1680 [142]
- 1690 :
- 1700 [143] -------------------------------------------------------
- 1710 [143] --- get program file starting address and display
- 1720 [143] -------------------------------------------------------
- 1730 [161]#2, a$, b$: [143] first two bytes
- 1740 [139] a$[178]"" [167] a$[178][199](0): [143] correct null string bug
- 1750 [139] b$[178]"" [167] b$[178][199](0): [143] correct null string bug
- 1760 ad[178]256[172]([198](b$))[170][198](a$): [143] address=low byte+(256)*(high byte)
- 1770 [153] "(NULL)he starting address of this program
- 1780 print "is" ad "in decimal."
- 1790 :
- 1800 rem *** 2049=(hex 0801), normal start of c64 basic
- 1810 if ad=2049 then print "[201]t is probably a [195]64 [194][193][211][201][195] program.": return
- 1820 :
- 1830 rem *** 7169=(hex 1c01), normal start of c128 basic
- 1840 if ad=7169 then print "[201]t is probably a [195]128 [194][193][211][201][195] program.": return
- 1850 :
- 1860 rem *** if not c64 or c128 basic, default to mach language
- 1870 print "[201]t is probably a machine language
- 1880 [153] "program."
- 1890 [142]
- 1900 :
- 1910 [143] ----------------------------------------
- 1920 [143] --- check for end of relative file
- 1930 [143] ----------------------------------------
- 1940 [132]15,er: [143] check for 'record not present' error
- 1950 [139] er[178]50 [167] r[178]0: [143] 'record not present'
- 1960 [142]
- 1970 :
- 1980 [143] ----------------------------------------
- 1990 [143] --- read error channel, stop if error
- 2000 [143] ----------------------------------------
- 2010 [132]15,er,er$
- 2020 [139] er[179]20 [167] [142]
- 2030 [153] "loaddisk error---
- 2040 print ""er,er$
- 2050 if case=4 then print chr$(142)
- 2060 print "re-run this program to continue
- 2070 [128]
-